package com.ext.portlet.registration.service.impl;

import java.rmi.RemoteException;
import java.util.List;

import com.ext.portlet.registration.NoSuchSchoolException;
import com.ext.portlet.registration.model.School;
import com.ext.portlet.registration.model.Student;
import com.ext.portlet.registration.service.base.SchoolLocalServiceBaseImpl;
import com.ext.portlet.registration.service.persistence.SchoolUtil;
import com.liferay.portal.PortalException;
import com.liferay.portal.SystemException;
import com.liferay.portal.service.UserServiceUtil;
import com.liferay.portal.service.persistence.UserUtil;


public class SchoolLocalServiceImpl extends SchoolLocalServiceBaseImpl {
	
	public List<School> getAllSchools()
		throws PortalException, SystemException, RemoteException {
			return schoolPersistence.findAll();
	}
	
	public List<School> getByStatus(Integer status) throws SystemException{
		return SchoolUtil.findByStatus(status);
	}
	
	public School getBySecretPin(String secretPin) throws NoSuchSchoolException, SystemException{		
		
		return SchoolUtil.findBySecretPin(secretPin);
	}
	
	public School secretPinValidation (String secretPin) throws SystemException{		
		
		return schoolPersistence.fetchBySecretPin(secretPin);
	}
	
	public School getByEmail(String emailAddress) throws SystemException{
		return schoolPersistence.fetchByCpEmailAddress(emailAddress);
	}
	
	public School getByLoginId(String loginId) throws NoSuchSchoolException, SystemException{		
		
		return SchoolUtil.fetchByLoginId(loginId);
	}
	
	public List<School> getByUserId(Long userId) 
	throws SystemException {	

	return schoolPersistence.findByUserId(userId);
}	
	
}
